package top.liujiachen.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import top.liujiachen.entity.Dept;
import top.liujiachen.mapper.DeptMapper;
import top.liujiachen.service.IDeptService;

import java.util.List;

@Service
public class DeptService extends ServiceImpl<DeptMapper, Dept> implements IDeptService {

    @Override
    public Dept get(Integer deptNo) {
        Dept dept = null;
        if (deptNo != null) {
            Wrapper<Dept> wrapper = lambdaQuery().eq(Dept::getDeptNo, deptNo).getWrapper();
            dept = baseMapper.selectOne(wrapper);
        }
        return dept;
    }

    @Override
    public List<Dept> getAll() {
        return baseMapper.selectList(null);
    }

}
